struct domain *d = v->domain;
int rc;
+ v->arch.vcpu_info_mfn = INVALID_MFN;
+
v->arch.flags = TF_kernel_mode;
pae_l3_cache_init(&v->arch.pae_l3_cache);
{
if ( is_pv_32on64_vcpu(v) )
release_compat_l4(v);
+
+ unmap_vcpu_info(v);
+
+ if ( is_hvm_vcpu(v) )
+ hvm_vcpu_destroy(v);
}
int arch_domain_create(struct domain *d)
void arch_domain_destroy(struct domain *d)
{
- struct vcpu *v;
-
- for_each_vcpu ( d, v )
- unmap_vcpu_info(v);
-
if ( is_hvm_domain(d) )
- {
- for_each_vcpu ( d, v )
- hvm_vcpu_destroy(v);
hvm_domain_destroy(d);
- }
paging_final_teardown(d);
struct domain *d = v->domain;
unsigned long mfn;
- if ( v->vcpu_info_mfn == INVALID_MFN )
+ if ( v->arch.vcpu_info_mfn == INVALID_MFN )
return;
- mfn = v->vcpu_info_mfn;
+ mfn = v->arch.vcpu_info_mfn;
unmap_domain_page_global(v->vcpu_info);
v->vcpu_info = shared_info_addr(d, vcpu_info[v->vcpu_id]);
- v->vcpu_info_mfn = INVALID_MFN;
+ v->arch.vcpu_info_mfn = INVALID_MFN;
put_page_and_type(mfn_to_page(mfn));
}
if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
return -EINVAL;
- if ( v->vcpu_info_mfn != INVALID_MFN )
+ if ( v->arch.vcpu_info_mfn != INVALID_MFN )
return -EINVAL;
/* Run this command on yourself or on other offline VCPUS. */
memcpy(new_info, v->vcpu_info, sizeof(*new_info));
v->vcpu_info = new_info;
- v->vcpu_info_mfn = mfn;
+ v->arch.vcpu_info_mfn = mfn;
/* Set new vcpu_info pointer /before/ setting pending flags. */
wmb();
void free_domain(struct domain *d)
{
- struct vcpu *v;
- int i;
-
- for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
- {
- if ( (v = d->vcpu[i]) == NULL )
- continue;
- vcpu_destroy(v);
- sched_destroy_vcpu(v);
- free_vcpu_struct(v);
- }
-
- sched_destroy_domain(d);
xfree(d);
}
v->domain = d;
v->vcpu_id = vcpu_id;
- v->vcpu_info_mfn = INVALID_MFN;
v->runstate.state = is_idle_vcpu(v) ? RUNSTATE_running : RUNSTATE_offline;
v->runstate.state_entry_time = NOW();
static void complete_domain_destroy(struct rcu_head *head)
{
struct domain *d = container_of(head, struct domain, rcu);
+ struct vcpu *v;
+ int i;
+
+ for ( i = MAX_VIRT_CPUS-1; i >= 0; i-- )
+ {
+ if ( (v = d->vcpu[i]) == NULL )
+ continue;
+ vcpu_destroy(v);
+ sched_destroy_vcpu(v);
+ free_vcpu_struct(v);
+ }
acm_domain_destroy(d);
arch_domain_destroy(d);
+ sched_destroy_domain(d);
+
free_domain(d);
send_guest_global_virq(dom0, VIRQ_DOM_EXC);